<template>
	<view class="wrap">
		<view class="orders-goods-list">
			<view class="orders-title flex-row">
				<view class="orders-title-my">{{ orderStatusList2[order.orderStatus] }}</view>
				<view class="orders-time">{{ order.createTime }}</view>
			</view>
			<!-- <image class="order-tag" src="https://cdn.quantifynet.cn/dti/icon_lable_blind_box@3x.png" v-if="order.orderType == 0"></image>
			<image class="order-tag" src="https://cdn.quantifynet.cn/dti/icon_lable_public_order@2x.png" v-if="order.orderType == 1"></image>
			<image class="order-tag" src="https://cdn.quantifynet.cn/dti/icon_lable_blind_box@2x.png" v-if="order.orderType == 2"></image> -->

			<view class="orders-goods-item" v-for="(item, index) in order.orderGoodsList" :key="index">
				<view class="goods-item-main flex-row" @click="gotoRouter('/pages-client/store/goodsInfo?id=' + item.goodsId)">
					<view class="goods-item-left"><image class="goods-item-pic" :src="item.thumbUrl"></image></view>

					<view class="goods-item-right">
						<view class="goods-name nowrap2">{{ item.goodsName }}</view>
						<view class="goods-spec">{{ item.spec }}</view>
						<view class="goods-btn flex-row">
							<view class="goods-price">{{ item.salePrice }}</view>
							<view class="goods-unit">元</view>
						</view>
					</view>

					<view class="goods-count">x{{ item.totalNum }}</view>
				</view>
			</view>

			<view class="orders-floor flex-row">
				<view class="orders-floor-left flex-col" v-if="order.orderStatus == 2" @click="updateOrderStatus">确认收货</view>
				<view
					class="orders-floor-right flex-col"
					v-if="order.orderStatus == 2 || order.orderStatus == 3"
					@click="gotoRouter('/pages-client/order/logistics?orderId=' + order.id)"
				>
					查看物流
				</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	props: {
		order: {
			type: Object,
			default: {}
		}
	},

	data() {
		return {};
	},
	onLoad(option) {},
	onShow() {},
	methods: {
		updateOrderStatus() {
			this.$tip.confirm('确定已收到货吗？').then(res => {
				if (res.confirm) {
					this.$api
						.updateOrderStatus({
							params: { orderId: this.order.id, status: 3 }
						})
						.then(res => {
							if (res.code == 200) {
								this.$tip.toast('签收成功！');
								this.order.orderStatus = 4;
							}
						});
				}
			});
		}
	}
};
</script>

<style lang="less">
.orders-goods-list {
	width: 690rpx;
	background: #ffffff;
	border-radius: 6rpx;
	padding: 30rpx 32rpx;
	margin: 0 auto 24rpx;
	background-color: rgba(255, 255, 255, 1);
	box-sizing: border-box;

	.orders-title {
		align-items: center;
		margin-bottom: 30rpx;
		.orders-title-my {
			color: rgba(51, 51, 51, 1);
			font-size: 36rpx;
			font-family: PingFangSC-Medium;
			font-weight: bold;
			margin-right: 31rpx;
		}
		.orders-time {
			color: rgba(153, 153, 153, 1);
			font-size: 26rpx;
			font-family: PingFangSC-Regular;
		}
	}

	.order-tag {
		width: 132rpx;
		height: 52rpx;
		// margin-top: 30rpx;
	}

	.orders-goods-item {
		background-color: rgba(255, 255, 255, 1);
		border-bottom: 1rpx solid rgba(51, 51, 51, 0.1);
		padding-bottom: 27rpx;
		.goods-item-head {
			width: 132rpx;
			height: 52rpx;
			// margin-bottom: 22rpx;
			display: block;
		}

		.goods-item-main {
			margin-top: 21rpx;
			.goods-item-left {
				width: 150rpx;
				height: 150rpx;
				border-radius: 12rpx;
				border: 1rpx solid rgba(234, 234, 239, 0.5);
				display: flex;
				align-items: center;
				justify-content: center;
				margin-right: 30rpx;
				.goods-item-blind {
					width: 84rpx;
					height: 107rpx;
				}
				.goods-item-pic {
					width: 146rpx;
					height: 146rpx;
				}
			}

			.goods-item-right {
				z-index: auto;
				width: 424rpx;
				height: 170rpx;
				display: flex;
				flex-direction: column;
				.goods-name {
					font-size: 30rpx;
					font-family: PingFang-SC-Bold;
					color: rgba(51, 51, 51, 1);
					line-height: 46rpx;
					font-weight: bold;
					overflow: hidden;
					text-overflow: ellipsis;
				}
				.goods-spec {
					font-size: 26rpx;
					font-family: PingFangSC-Regular;
					color: rgba(51, 51, 51, 1);
					line-height: 46rpx;
					overflow: hidden;
					text-overflow: ellipsis;
				}
				.goods-btn {
					width: 179rpx;
					height: 54rpx;
					border-radius: 27rpx;
					margin-top: 24rpx;
					align-items: center;
					.goods-price {
						color: #891e07;
						font-size: 34rpx;
						font-family: HYXiaoBoZheZhiTiJ;
					}
					.goods-unit {
						color: #891e07;
						font-size: 24rpx;
						font-family: PingFangSC-Regular;
						margin-top: 4rpx;
					}
				}
			}

			.goods-count {
				color: rgba(51, 51, 51, 1);
				font-size: 34rpx;
				font-family: DINPro-Bold;
				font-weight: bold;
				margin-top: 48rpx;
			}
		}
	}

	.orders-floor {
		align-items: center;
		justify-content: space-around;
		margin: 20rpx 40rpx 0;
		.orders-floor-left {
			width: 216rpx;
			height: 80rpx;
			background: #891e07;
			border-radius: 8rpx;
			font-size: 32rpx;
			font-family: PingFang-SC-Medium, PingFang-SC;
			font-weight: 500;
			color: #ffffff;
			align-items: center;
			justify-content: center;
		}
		.orders-floor-right {
			width: 220rpx;
			height: 82rpx;
			border-radius: 8rpx;
			border: 1rpx solid #891e07;
			font-size: 28rpx;
			font-family: PingFang-SC-Regular, PingFang-SC;
			font-weight: 400;
			color: #891e07;
			align-items: center;
			justify-content: center;
		}
	}
}
</style>
